package lanou.giftsay_01.main.categorymain;

import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;

import lanou.giftsay_01.R;
import lanou.giftsay_01.adapter.LanmuAdapter;
import lanou.giftsay_01.bean.CategoryBean;
import lanou.giftsay_01.tools.BaseActivity;
import lanou.giftsay_01.tools.NetTool;
import lanou.giftsay_01.tools.URLValues;

/**
 * Created by dllo on 16/8/22.
 */
public class LanmuActivity extends BaseActivity {

    private ListView lanmnLv;
    private CategoryBean categoryBean;
    private Button button;


    @Override
    protected int setLayout() {
        return R.layout.lanmu_activity;
    }

    @Override
    protected void initView() {
        lanmnLv = (ListView) findViewById(R.id.lanmu_lv);
        button = (Button) findViewById(R.id.btn_lanmu_category);

    }

    @Override
    protected void initDate() {
        NetTool netTool = new NetTool();
        netTool.getNetData(URLValues.SPECIALCATEGORY, CategoryBean.class, new NetTool.NetListener<CategoryBean>() {
            @Override
            public void onSuccess(CategoryBean categoryBean) {
                LanmuAdapter adapter  = new LanmuAdapter(getApplicationContext());
                adapter.setCategoryBean(categoryBean);
                lanmnLv.setAdapter(adapter);

            }

            @Override
            public void onError(String errorMsg) {

            }
        });
     button.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View v) {
             finish();
         }
     });
        
    }
}
